<template>
	<view>
		<view class="my-search-container" :style="{'background-color': bgcolor}" @click="searchBoxHandler">
			<view class="my-search-box" :style="{'border-radius': radius + 'px'}">
				<!-- 使用uni-ui提供的图标组件 -->
				<uni-icons type="search" size="30" ></uni-icons>
				<text class="placeholder">搜索</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"my-search",
		props:{
			
			// 背景颜色
			bgcolor: {
				typeof: String,
				default: '#FFB6C1'
			},
			// 圆角尺寸
			radius: {
				typeof: Number,
				// px
				default: 18
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			// 自定义事件
			searchBoxHandler(){
				console.log('...')
				// 调用外部用户点击事件
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss">
.my-search-container{
	height: 50px;
	// background-color: #FFB6C1;
	display: flex;
	align-items: center;
	padding: 0 10px;
	.my-search-box{
		height: 36px;
		background-color: #FFFFFF;
		// border-radius: 18px;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;	
		.placeholder{
			font-size: 15px;
			margin-left: 5px;
		}
	}
}
</style>